package com.sl.spring.intergration.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

 

import com.sl.spring.intergration.util.JsonUtils;
import com.sl.spring.intergration.vo.User;

@RestController
public class RedisController {

	@Autowired
	private StringRedisTemplate stringRedisTemplate;
	
	@RequestMapping(value="test")
	public User test(){
		
		User u = new User();
		u.setHeadPortraitId(1);
	    u.setUserName("shuli");
	    u.setId(21);
	    
	    //stringRedisTemplate.opsForValue().set("json:user", JsonUtils.objectToJson(u));
	    //User jsonUser = JsonUtils.jsonToPojo(stringRedisTemplate.opsForValue().get("json:user"), User.class);
		return u;
	}
}
